package com.core.Design.factoryMethod;

/**
 * Created by admin on 2017/6/6.
 */
public class OperatorFactory {
    private Double t;
    private Double t1;
    private OperatorFactory(){

    }
    //单例
    public static OperatorFactory  instances(Double t,Double t1){
        return new OperatorFactory(t,t1);
    }
    private OperatorFactory(Double t,Double t1){
        this.t = t;
        this.t1 = t1;
    }
    public Operator resultBack(String operator){
        //工厂
        switch (operator){
            case "+":
                return new Add(t,t1);
            default:
                break;
        }
        return null;
    }
}
